package com.atguigu.controller;

import com.atguigu.pojo.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
@Tag(name = "用户控制器")
public class UserController {

    @Operation(summary="分页查询用户")
    @GetMapping("/{pageNo}/{pageSize}")
    public List<User> list(@Parameter(description= "页码") @PathVariable Integer pageNo ,@Parameter(description = "页大小") @PathVariable Integer pageSize){
        return List.of(
                User.builder().id(1l).name("jim1").age(18).email("jim1@126.com").build(),
                User.builder().id(2l).name("jim2").age(28).email("jim2@126.com").build(),
                User.builder().id(3l).name("jim3").age(38).email("jim3@126.com").build(),
                User.builder().id(4l).name("jim4").age(48).email("jim4@126.com").build(),
                User.builder().id(5l).name("jim5").age(58).email("jim5@126.com").build()
        );
    }

}
